{include file="pub:header" /}
<link rel="stylesheet" href="/static/admin/css/sku.css?c=5510">
<script type="text/javascript" src="/static/admin/js/sku.js?c=6515"></script>
<script>
<?php if($info['attr_groups']){ ?>
var attr_groups=<?php echo $info['attr_groups'];?>;
var val_groups=<?php echo $var_groups;?>;
<?php }else{ ?>
var attr_groups='',val_groups='';
<?php } ?>
</script>
<style>
.tj{border-collapse:collapse;table-layout:fixed;white-space:normal;overflow:hidden}
.tj input{ background: #fff;border: 1px solid #d0d0d0;font-family: Verdana,Geneva,sans-serif,"宋体";font-size: 12px;height:18px;padding: 2px 0 2px 5px;}
.remove{float:right;margin-top:2px;color:red;margin-left:5px;}
.remove_float{width:70%!important}
.goodimg{width:200px;background: #faffee none repeat scroll 0 0;border: 1px dashed #aad381;}
#files li{float:left;margin-right: 10px;margin-top: 10px;text-align: center;}
#files img{max-width:180px;height:120px;margin:5px;}
</style>
</head>
<body>


	<div class="subnav">
		<div class="content_menu ib_a blue line_x">
            <a href="javascript:;"><span class="pagetitle">【应用商品编辑】</span></a>
			<span>|</span>
			<a href="javascript:;" class="on">
				<em>编辑</em>
			</a>
		</div>
	</div>

			<form action="{:url('goodsedit')}" method="post"  id="formeditor">
            <input type="hidden" name="id" id="gid" value="{$info['id']}">
            <input type="hidden" name="type" value="1">


	<div class="pad_lr_10">

					<table width="100%" cellspacing="0" class="table_form">

						<tr>
							<th><font color="red">*</font> 商品名称 :</th>
							<td>
								<input type="text" name="name" class="input-text" size="100" value="{$info['name']}">
							</td>
						</tr>

						<tr>
							<th>副标题 :</th>
							<td>
								<input type="text" name="keywords" class="input-text" size="100" value="{$info['keywords']}">
							</td>
						</tr>


						<tr>
							<th width="120">封面图片 :</th>
							<td>
							    <div style="margin-bottom:5px;">
							       <input type="hidden" name="coverimg" id="thumb" value="{$info['coverimg']}">
							       {notempty name="info['coverimg']"}
							       <img height="113" src="{$info['coverimg']}" id="thumb_preview" style="cursor:hand">
							       {else/}
							       <img height="113" src="/static/common/attach/images/upload-pic.png" id="thumb_preview" style="cursor:hand">
							       {/notempty}
							       <a href="javascript:;" onclick="removeImg('thumb');">移除</a>
							    </div>
							    <span style="color:red;">图片比例：1:1；最佳图片尺寸：800x800</span>
                			</td>
						</tr>

					    <tr>
							<th><font color="red">*</font> 图片列表 :</th>
							<td>
							    <div  id="files">
							    <?php
							     $files=string2array($info['album']);
							    ?>
							  	{volist name="files" id="vo"}
                                   <li id="multifile{$key}">
                                       <div class="goodimg">
                                       <img src="{$vo['url']}" id="multi{$key}_preview">
                                       <input id="multi{$key}" type="hidden" value="{$vo['url']}" name="files_url[]">
                                       <p><a href="javascript:top_div('multifile{$key}')">封面图</a> <a href="javascript:remove_div('multifile{$key}')">移除</a> <a href="javascript:moveup_div('multifile{$key}')">上移</a> <a href="javascript:movetop_div('multifile{$key}')">置顶</a> <a href="javascript:imageCut('multi{$key}')">裁剪</a></p>
                                       </div>
                                       </li>
							    {/volist}
							    </div>
						        <div class="bk10"></div>
						        <input type="button" id="picupload" onclick="javascript:flashupload(0,'图册上传',20,'jpg|jpeg|png|gif',5,'files',change_multifile_images)" class="btn" value="上传图片">
							</td>
						</tr>

						<tr>
							<th> 商品分类 :</th>
							<td>
								<select name="cat"  class="J_cate_select mr10">
								  <option value="0">根目录</option>
								   {volist name="gcat" id="vo"}
                                       <option value="{$vo['id']}"<?php echo $vo['id']==$info['cat']?' selected':'';?>>{$vo['name']}</option>
                                   {/volist}
								  </select>
							</td>
						</tr>


						<!------ 商品属性  sku 设置  开始 ------->

						<input type="hidden" name="attr_groups" value="">
						<input type="hidden" name="val_groups" value="">
						<tr>
							<th style="width:6%;vertical-align:top;">商品规格 :</th>
							<td>
								<div class="item_edit">
									<div class="item_list"></div>
									<div class="common">
										<input type="button" id="additem" class="btn" value="添加规格项目">
										<span id="totalsum"></span>
									</div>
								</div>

								<div class="item_group" id="skuTable">

								</div>
							</td>
						</tr>

						<!--sku模板,用于克隆,生成自定义sku-->
						<div class="item_node" id="itemModel" style="display: none;">
							<div class="item_node_tit"><span>规格名：</span><input class="input-text" type="text" value=""><a href="javascript:void(0);" class="delCusSkuType">删除</a></div>
							<div class="item_node_val"><span>规格值：</span>
								<div class="item_node_val_list">
									<a href="javascript:;" class="itemModelnode">添加规格值</a>
								</div>
							</div>
						</div>

						<!--单个sku值克隆模板-->
						<div class="item_node_val_list_node" id="itemModelnode" style="display: none;">
							<input class="input-text" type="text" value=""><i href="javascript:void(0);" class="delCusSkuVal">
							<div class="img_box">
								<img src="/static/common/img/img/1055.png" alt="">
							</div>
						</i>
						</div>

						<!------ 商品属性  sku 设置  结束 ------->

						<tr>
							<th width="80"> 内容	  </th>
							<td>
								<textarea name="content" id="content">{$info['content']}</textarea>
								<script type="text/javascript" src="/static/plugin/editor/ckeditor3/ckeditor.js?c=51"></script><script type="text/javascript">
								$(function(){
									CKEDITOR.replace( 'content',{height:500,pages:false,subtitle:false,textareaid:'content',
										toolbar :
												[
													['Source','-'],
													['Cut','Copy','Paste','PasteText','PasteFromWord','-'],
													['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['ShowBlocks'],['Image','flashplayer'],['Maximize'],
													'/',
													['Bold','Italic','Underline','Strike','-'],
													['Subscript','Superscript','-'],
													['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
													['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
													['Link','Unlink','Anchor'],
													['Table','HorizontalRule','Smiley','SpecialChar'],
													'/',
													['Styles','Format','Font','FontSize'],
													['TextColor','BGColor']
												]
									});
								})
							</script></td></tr>


					</table>
		<script>
			function checkeditor(){
				for(instance in CKEDITOR.instances)CKEDITOR.instances[instance].updateElement();
			}
		</script>
		</div>
	</div>
    </form>

	<div class="fix_h" style="height:54px;">
		<div class="mt10" style="position: fixed;z-index: 9999;width: 100%;text-align:center;bottom: 0px;background:#ccc;height:54px;overflow:hidden;">
			<?php if($info['name']){ ?>
			<input type="button" value="提交修改" onclick="createPostdata();checkeditor();ajaxnorefrespost('formeditor');" id="dosubmit" name="dosubmit" class="smt mr10" style="margin-top:12px;display:inline-block;float:none;">
			<?php }else{ ?>
			<input type="button" value="新增" onclick="createPostdata();checkeditor();ajaxpost('formeditor');" id="dosubmit" name="dosubmit" class="smt mr10" style="margin-top:12px;display:inline-block;float:none;">
			<?php } ?>
			<br />
			<br />
			<br />
		</div>
	</div>

{include file="pub:footer" /}
